package yznu_Bean_login;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;

import yznu_jdbc.JDpoor;
//��¼bean���û���֤��
public class Login_Database {

	Connection con = new JDpoor().CreateCon();;
	Statement sql = null;
	PreparedStatement pre = null;
	ResultSet rs = null;
	boolean f = false;
	
	public String AdminCheck(String Username, String Password) {
//		֤
		String name = "NULL";
		String condition = "select Username from admin_info where Username=? AND Password=?";
		try {
			pre = con.prepareStatement(condition);
			pre.setString(1, Username);
	    	pre.setString(2, Password);
	    	rs=pre.executeQuery(); 
	    	if(rs.next()){
	    		name = rs.getString("Username");
	    	}
	    	else
	    		name = "error";
		} catch (Exception e) {
			// TODO Auto-generated catch block
			name = "error";
		}
		
		return name;
	}

}
